Skip to content

Conversation

@xabi
Copy link

@xabi xabi commented Jan 12, 2026

Summary

The result field can be nil for error messages which contain an errors array instead. This PR fixes the handling of error result messages from the CLI.

Changes

  • Remove result from @enforce_keys (no longer required)
  • Update type spec to allow nil: result: String.t() | nil
  • Remove result from required_fields validation
  • Fix String.Chars protocol implementation:
    • Handle nil result with errors array
    • Handle nil result without errors
    • Display errors when result is nil
  • Fix protocol implementation module name (ResultMessage instead of Result)

Test Plan

  • Error messages with errors array are properly handled
  • Error messages without result field don't crash
  • Success messages with result field continue to work as expected

This fixes issues when the CLI returns error results that don't have a result field.

The result field can be nil for error messages which contain
an errors array instead. This change:
- Removes result from @enforce_keys
- Updates type spec to allow nil
- Removes result from required_fields validation
- Fixes String.Chars implementation to handle nil result
- Displays errors when result is nil

Fixes handling of error result messages from the CLI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant